# name : Generates all combinations of the indices
# key : allcombi.indice
# contributor: Shuguang Sun
# --
data _null_;
   array x[5] $3 ('ant' 'bee' 'cat' 'dog' 'ewe');
   array c[3] $3;
   array i[3];
   n=dim(x);
   k=dim(i);
   i[1]=0;
   ncomb=comb(n, k);   /* The one extra call goes back */
   do j=1 to ncomb+1;  /* to the first combination. */
      call allcombi(n, k, of i[*], add, remove);
      do h=1 to k;
         c[h]=x[i[h]];
      end;
      put @4 j= @10 'i= ' i[*] +3 'c= ' c[*] +3 add= remove=;
   end;
run;